﻿using MaterialManagement.API.Application.Command.ERP;
using MaterialManagement.API.Dtos;
using MaterialManagement.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MaterialManagement.API.Controllers
{
    /// <summary>
    /// 过程检验控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProcessInspectionController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProcessInspectionController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 查询检验单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<List<ProcessInspectionDto>>> GetProcessInspection([FromQuery]GetProcessInspectionCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 新增检验单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<int>> CreateProcessInspection(CreateProcessInspectionCommand request)
        {
            return mediator.Send(request);
        }
    }
}
